package com.wanmei.commons;

import com.wanmei.pojo.Result;

/**
 * 数据响应处理工具类
 */
public class ResultUtils {
    /**
     * 返回成功数据
     * @param msg
     * @param data
     * @param count
     * @return
     */
    public static Result success(String msg,Object data,int count) {
        Result result = new Result();
        result.setCode(0);
        result.setMsg(msg);
        result.setData(data);
        result.setCount(count);
        return result;
    }

    /**
     * 返回失败数据
     * @param msg
     * @param data
     * @param count
     * @return
     */
    public static Result fail(String msg,Object data,int count) {
        Result result = new Result();
        result.setCode(1);
        result.setMsg(msg);
        result.setData(data);
        result.setCount(count);
        return result;
    }
}
